///*
// * Copyright The OpenTelemetry Authors
// * SPDX-License-Identifier: Apache-2.0
// */
//
//package com.xiashitech.agent.instrumentation.netty.netty_v4_common.client;
//
//import com.xiashitech.agent.instrumentation.netty.netty_common.NettyConnectionRequest;
//import io.netty.channel.Channel;
//import io.netty.channel.socket.DatagramChannel;
//import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.net.InetSocketAddressNetClientAttributesGetter;
//
//import javax.annotation.Nullable;
//import java.net.InetSocketAddress;
//import java.net.SocketAddress;
//
//import static io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP;
//import static io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_UDP;
//
//final class NettyConnectNetAttributesGetter
//    extends InetSocketAddressNetClientAttributesGetter<NettyConnectionRequest, Channel> {
//
//  @Nullable
//  @Override
//  public InetSocketAddress getAddress(NettyConnectionRequest request, @Nullable Channel channel) {
//    SocketAddress remoteAddress = null;
//    if (channel != null) {
//      remoteAddress = channel.remoteAddress();
//    }
//    // remote address on end() may be null when connection hasn't been established
//    if (remoteAddress == null) {
//      remoteAddress = request.remoteAddressOnStart();
//    }
//    if (remoteAddress instanceof InetSocketAddress) {
//      return (InetSocketAddress) remoteAddress;
//    }
//    return null;
//  }
//
//  @Override
//  public String transport(NettyConnectionRequest request, @Nullable Channel channel) {
//    return channel instanceof DatagramChannel ? IP_UDP : IP_TCP;
//  }
//}
